home *** CD-ROM | disk | FTP | other *** search
- Path: feenix.metronet.com!news
- From: Gavin Williams <gavin@metronet.com>
- Newsgroups: comp.os.ms-windows.programmer.win32,comp.lang.c++
- Subject: Sockets don't work under VC++ 4.0 ?!!
- Date: Sun, 14 Jan 1996 00:54:49 -0600
- Organization: Texas Metronet, Inc (login info (214/705-2901 - 817/571-0400))
- Message-ID: <30F8A8B9.279B@metronet.com>
- NNTP-Posting-Host: dal150.metronet.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b3 (WinNT; I)
-
- I finally got around to doing a little Windows Sockets programming in VC++
- 4.0 today and was quickly greeted with an ugly problem--I can't get it to
- create a socket.
-
- The CSocket::Create() function consistently failed, and
- CSocket::GetLastError() returned WSAEPROTOTYPE. I tried running the CHATTER
- sample program, and its socket creation failed with the same error.
-
- Then I tried tried straight socket API calls (as opposed to using the CSocket
- or CAsyncSocket classes). The "socket" function also failed with the
- WSAEPROTOTYPE error.
-
- Finally, I tried some simple sockets code in VC++ 1.52c and VC++ 2.2. The
- code *worked* in both cases. The *exact same code* works fine when compiled
- with 2.2 but fails when compiled with 4.0.
-
- Here's a sample of my test code:
-
- WSADATA wsadata;
- WSAStartup( 0x0101, &wsadata );
-
- SOCKET sock;
- if( INVALID_SOCKET == (sock = socket( PF_INET, SOCK_STREAM, 0 )) )
- {
- int i = WSAGetLastError();
- }
-
- WSACleanup();
-
- Two other tidbits: I'm running NT 3.51, and Microsoft's knowledge base
- contained nothing about this problem.
-
- Has anyone else out there encountered this problem? Is anyone using sockets
- successfully with VC++ 4.0?
-
- Gavin Williams
- gavin@metronet.com
-